<template>
  <div class="category-nav">
    <ul class="category-list">
      <li v-for="(category, index) in categories" :key="index" @click="handleCategoryClick(category)">
        <span class="category-icon" v-if="category.icon">
          <i :class="category.icon"></i>
        </span>
        <span class="category-name">{{ category.name }}</span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'CategoryNav',
  data() {
    return {
      categories: [
      ]
    }
  },
  methods: {
    handleCategoryClick(category) {
      this.$emit('category-click', category)
    }
  }
}
</script>

<style scoped>
.category-nav {
  width: 100%;
  background-color: #fff;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}

.category-list li {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.3s;
}

.category-list li:hover {
  background-color: #f5f7fa;
}

.category-icon {
  margin-right: 8px;
}

.category-name {
  font-size: 14px;
  color: #606266;
}
</style>
